package com.aaa.dao;


import com.aaa.pojo.Change;
import com.aaa.pojo.Term_Financial;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface Term_Financial_Mapper {
    @Select("select * from term_financial t,investment_horizon h WHERE t.h_id = h.h_id")
    List<Term_Financial> selectAll();
    @Insert("INSERT into term_financial(t_name,t_income,t_yield,t_amount,h_id)VALUES(#{t_name},#{t_income},#{t_yield},#{t_amount},#{h_id})")
    boolean insertFinancial(Term_Financial financial);
    @Select("select * from term_financial t,investment_horizon h WHERE t.h_id = h.h_id and t.t_id=#{t_id}")
    Term_Financial selectById(Integer t_id);
    @Update("UPDATE term_financial,investment_horizon SET t_name=#{t_name},t_income=#{t_income},t_yield=#{t_yield},t_amount=#{t_amount},h_deadline=#{h_deadline},h_day=#{h_day} WHERE t_id=#{t_id}")
    boolean updateFinancial(Term_Financial financial);
    @Delete("DELETE from term_financial where t_id=#{t_id}")
    boolean deleteFinancial(Integer t_id);
}
